import http from "@/api/config/http";
import { IQuery, ITableResponse } from "@/interface/IAxios";
import { GoodsCategory } from "./types";

export function listCategory(query?: IQuery): Promise<ITableResponse<GoodsCategory>> {
  return http.request({
    url: "/goods/category/list",
    method: "get",
    params: query
  });
}
export function queryCategory(query?: IQuery): Promise<ITableResponse<GoodsCategory>> {
  return http.request({
    url: "/goods/category/query",
    method: "get",
    params: query
  });
}

export function addCategory(data?: Partial<GoodsCategory>): Promise<ITableResponse<GoodsCategory>> {
  return http.request({
    url: "/goods/category",
    method: "post",
    data
  });
}
export function deleteCategory(ids: string[]): Promise<ITableResponse<GoodsCategory>> {
  return http.request({
    url: `/goods/category/${ids.join(",")}`,
    method: "delete"
  });
}
